﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.ProcessManagement;

namespace Digitalmes.Model.ProcessManagement
{
    /// <summary>
    /// 工序文档
    /// </summary>
	[Table("ProcessDoc")]

    [Display(Name = "_Model.ProcessDoc")]
    public class ProcessDoc : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._ProcessDoc._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._ProcessDoc._Route")]
        [Comment("工艺路线")]
        public ProcessRoute Route { get; set; }
        [Display(Name = "_Model._ProcessDoc._Route")]
        [Comment("工艺路线")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public long? RouteId { get; set; }
        [Display(Name = "_Model._ProcessDoc._Op")]
        [Comment("工序")]
        public ProcessRouteItem Op { get; set; }
        [Display(Name = "_Model._ProcessDoc._Op")]
        [Comment("工序")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public long? OpId { get; set; }
        [Display(Name = "_Model._ProcessDoc._OpCode")]
        [Comment("工序编号")]
        public string OpCode { get; set; }
        [Display(Name = "_Model._ProcessDoc._ProductId")]
        [Comment("产品")]
        public long? ProductId { get; set; }
        [Display(Name = "_Model._ProcessDoc._FileName")]
        [Comment("文件名称")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string FileName { get; set; }
        [Display(Name = "_Model._ProcessDoc._FileType")]
        [Comment("文件类型")]
        public string FileType { get; set; }
        [Display(Name = "_Model._ProcessDoc._FileDoc")]
        [Comment("文档")]
        public FileAttachment FileDoc { get; set; }
        [Display(Name = "_Model._ProcessDoc._FileDoc")]
        [Comment("文档")]
        public Guid? FileDocId { get; set; }
        [Display(Name = "_Model._ProcessDoc._RemotePc")]
        [Comment("远程主机")]
        [RegularExpression("(?:(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)$")]
        public string RemotePc { get; set; }
        [Display(Name = "_Model._ProcessDoc._RemotePath")]
        [Comment("远程主机目录")]
        public string RemotePath { get; set; }
        [Display(Name = "_Model._ProcessDoc._UserName")]
        [Comment("用户名")]
        public string UserName { get; set; }
        [Display(Name = "_Model._ProcessDoc._Pwd")]
        [Comment("密码")]
        public string Pwd { get; set; }
        [Display(Name = "_Model._ProcessDoc._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

        [Display(Name = "_Model._ProcessParameter._Active")]
        [Comment("激活")]

        public bool Active { get; set; } = false;

    }

}
